﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;


namespace TrackSystem.Entities.Models
{
    /// <summary>
    /// 控制逻辑表
    /// </summary>
    [Table("logic")]
    public class LogicTable
    {
        /// <summary>
        /// 统一标识符
        /// </summary>
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [Display(Name = "统一标识符")]
        public int Id { get; set; }

        /// <summary>
        /// 通道名称
        /// </summary>
        [Required]
        [Display(Name = "逻辑回路名称")]
        public string Name { get; set; }

        /// <summary>
        /// 控制回路描述
        /// </summary>
        public string? Description { get; set; }

        /// <summary>
        /// 控制回路使能
        /// </summary>
        public bool Enabled { get; set; }

        /// <summary>
        /// 逻辑运行条件表达式
        /// </summary>
        public string? ConditionFormula { get; set; }

        /// <summary>
        /// 计算表达式
        /// </summary>
        public string? ClacateFormula { get; set; }

        /// <summary>
        /// 运算结果输出变量, 可以写多个，用空格隔开即可
        /// </summary>
        public string? ResultReg { get; set; }

        /// <summary>
        /// 是否计算结果发生改变才更新输出变量
        /// </summary>
        public bool UpdateWhenChanged { get; set; }

        /// <summary>
        /// 该传感器关联的设备ID
        /// </summary>
        public int equipId { get; set; }

        /// <summary>
        /// 该传感器关联的设备描述
        /// </summary>
        public EquipTable Equip { get; set; }
    }
}
